<template>
  <!-- 公租房 -->
  <div class="public-house-container">
    <div class="house-item" v-for="(item, index) in houseList" @click="goDetail(item.id)" :key="index">
      <div class="item-img">
        <img :src="item.coverImg+'?imageView2/1/w/300'" alt="">
      </div>
      <div class="item-desc">
        <p class="house-title">{{item.quart}}</p>
        <p class="house-area">
          地址：{{item.projectAddress}}
        </p>
        <p class="house-price">
          <span>参考租金：<span class="color-red">￥{{item.rental}}</span>元/㎡/月</span>
        </p>
        <p class="house-num">可租套数：{{item.rentableNumber}}</p>
        <p class="house-type">装修情况：{{item.decoration}}</p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      houseList: [],
      houseList1: [
        {
          img: 'http://img.tuituifang.com/4/pic/20160404/31/1459750171233832103.jpg?imageView2/1/w/300',
          name: '融悦山居1',
          price: '99',
          area: '龙岗区',
          houseNum: '999',
          type: '普通装修'
        },
        {
          img: 'http://img.tuituifang.com/4/pic/20160404/31/1459750171233832103.jpg?imageView2/1/w/300',
          name: '融悦山居2',
          price: '88',
          area: '龙岗区',
          houseNum: '888',
          type: '普通装修'
        },
        {
          img: 'http://img.tuituifang.com/4/pic/20160404/31/1459750171233832103.jpg?imageView2/1/w/300',
          name: '融悦山居3',
          price: '77',
          area: '龙岗区',
          houseNum: '666',
          type: '普通装修'
        }
      ]
    }
  },
  created () {
    this.getInitData()
  },
  methods: {
    // 获取公租房列表
    getInitData () {
      this.$axiosPosting(this.$api.getHousePublicNewInfos).then(res => {
      // this.$axiosPosting('http://119.23.151.161:8600/housePublic/getHousePublicNewInfos.html').then(res => {
        if (res.code === '0000') {
          this.houseList = res.data.housePublicList
          console.log(res.data)
        }
      })
    },
    goDetail (id) {
      this.$router.push({path: '/publicRentalHouseDetail', query: { id: id }})
    }
  }
}
</script>

<style lang="less">
  .public-house-container{
    font-size: 12px;
    height: 100vh;
    box-sizing: border-box;
    line-height: 1;
    color:#666;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    .house-item{
      padding:18px 0px;
      font-size: 12px;
      border-top:1px solid #eee;
      &:nth-child(1){
        border:none;
      }
      background: #fff;
      display: flex;
      height: 5.15rem;
      .item-img{
        flex-shrink: 0;
        // padding: 5px;
        width:6.9rem;
        overflow: hidden;
        img{
          width:100%;
          height:100%;
          object-fit: cover;
        }
      }
      .item-desc{
        flex: 1;
        display: flex;
        flex-direction:column;
        padding-left:10px;
        justify-content: space-between;
        .house-title{
          font-weight: normal;
          font-size: 17px;
          color:#343434
        }
        .house-area{
          width: 10rem;
          color:#979797;
          text-overflow: ellipsis;
          overflow: hidden;
          white-space: nowrap;
        }
        .house-price{
          .color-red{
            font-weight: normal;
            font-size: 18px;
            color:#ff3c00;
          }
        }
      }
    }
  }
</style>

